/**
This file is part of Gel2DE.

    Gel2DE is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Gel2DE is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Gel2DE.  If not, see <http://www.gnu.org/licenses/>.

	Copyright (C) 2012, University of Bergen
*/

#pragma once

#include<vector>
#include<utility>
#include<algorithm>
#include<math.h>

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"


#include "SpearmanRankData.h"
#include "GelImage.h"


class SpearmanRankOrderCorrCoeff
{
public:
	SpearmanRankOrderCorrCoeff(int aNelements);
	SpearmanRankOrderCorrCoeff(std::vector<double>* aX, std::vector<double>* aY);

	~SpearmanRankOrderCorrCoeff(void);

	std::pair<double, double>* calculateCorrCoeff(bool aCalcSignificance = true);
	void AddData(double, double);
	void AddData(std::vector<double>* aX, std::vector<double>* aY);
	void Clear();
	double StdDevI();
	void RemoveNoiseAdditive();
	void RemoveNoiseMultiplicative();
	void ScaleIntensity();


private:
	void rankX(std::vector<SpearmanRankElement*>*);
	void rankY(std::vector<SpearmanRankElement*>*);
	SpearmanRankData* m_data;

};



